<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <base href="<%=basePath%>">
    <link rel="stylesheet" href="static/component/pear/css/pear.css" />
    <link rel="stylesheet" href="static/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="static/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" >
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">申请单号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="purCode" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">经办人</label>
                            <div class="layui-input-inline">
                                <input type="text" name="eName" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">入库仓库</label>
                            <div class="layui-input-inline">
                                <select name="repostoryId"  class="layui-input specifiCations" lay-filter="relationship">
                                    <option value="-1">全部</option>
                                    <c:forEach items="${repostoryTypes}" var="repostoryTypes">
                                        <option value="${repostoryTypes.reponseTypePid}">${repostoryTypes.reponseTypeName}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="button" class="layui-btn layui-btn-primary"  lay-submit lay-filter="shelfComeoutSubmit"><i class="layui-icon"></i> 搜 索</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>

        <script type="text/html" id="toolbarDemo">
            <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
                <i class="layui-icon layui-icon-add-1"></i>
                新增
            </button>
            <%--<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
                <i class="layui-icon layui-icon-delete"></i>
                删除
            </button>--%>
        </script>
        <div class="layui-card">
            <div class="layui-card-body">
                <table id="godownEntryTable" lay-filter="godownEntryTable" class="layui-hide"></table>
            </div>
        </div>
        <%--      <c:if test="${emp.eDepartment==2}">

              </c:if>--%>

        <%--    <shiro:hasAnyRoles name="库管员">
                <c:if test="${}">

                <a class="pear-btn pear-btn-success pear-btn-sm" lay-event="sp"> <i class="layui-icon layui-icon-ok">审批</i></a>

                </c:if>

            </shiro:hasAnyRoles>--%>

    </div>

    <script type="text/html" id="shelfComeOut">
        <button class='pear-btn pear-btn-success pear-btn-sm' lay-event='xq'><i class='layui-icon layui-icon-form'></i></button>    </script>
</div>
<script src="static/component/layui/layui.js"></script>
<script src="static/component/pear/pear.js"></script>
<script>
    //引入table
    layui.use(['table','form'],function(){
        var $ = layui.jquery;
        var from = layui.form;
        var table = layui.table;
        var form = layui.form;
        //执行表格的数据填充操作
        table.render({
            //指定渲染的表格
            elem: '#godownEntryTable',
            //指定获取数据的路径
            url: 'godownEntry/likeGodownEntry',
            toolbar: '#toolbarDemo',
            //规定请求方式
            method: 'post',
            //开启分页
            page: true,
            check: true,
            //指定每页显示数
            limits: [1, 10, 15],
            even: true,
            cols: [[
                {field: 'purchase', title: '申请单编号', align: 'center',templet: "#purchase"},
                {field: 'goodstotalCount', title: '入库总数', align: 'center',templet: "#purchaseCount"},
                {field: 'emp', title: '经办人', align: 'center',templet: "#emp"},
                {field: 'remarkes', title: '备注', align: 'center'},
                {field: 'createDate', title: '入库时间', align: 'center'},
                {field: 'repostoryType', title: '入库仓库', align: 'center',templet: "#repostoryType"},
                {field: 'shelfComeOut', title: '操作', align: 'center',templet: "#shelfComeOut"},

            ]]




        })
        table.on("tool(godownEntryTable)",function (obj) {
                //打开一个页面,展示该申请单的详情信息
                if (obj.event == "xq") {
                    layer.open({
                        //执行修改用户操作
                        title: '入库单详情',
                        type: 2,
                        shade: 0.1,
                        area: ['50%', '50%'],
                        content:  'purchase/skipPurchaseDetails?purCode='+obj.data.purchase.purCode
                    })
                }
        })

        //表单提交事件
        form.on("submit(shelfComeoutSubmit)",function(data){
            //执行搜索重载
            table.reload('godownEntryTable',{
                //规定默认第几页
                page:{
                    curr:1
                },
                where:{
                    //请求参数添加
                    purchase:data.field.purCode,
                    eName:data.field.eName,
                    repostoryId:data.field.repostoryId
                }
            });
            return false;
        })


    })




</script>
<script type="text/html" id="purchase">
    {{d.purchase.purCode}}
</script>
<script type="text/html" id="purchaseCount">
    {{d.purchase.goodstotalCount}}
</script>
<script type="text/html" id="repostoryType">
    {{d.purchase.repostoryType.reponseTypeName}}
</script>
<script type="text/html" id="emp">
    {{d.emp.eName}}
</script>
</body>
</html>